//
//  C_HeaderFirstCollectionViewCell.m
//  音悦咖
//
//  Created by Best on 15/7/21.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "C_HeaderFirstCollectionViewCell.h"

@implementation C_HeaderFirstCollectionViewCell



- (void)dealloc
{
    [_countLabel release];
    [_nameLabel release];
    [_imageView release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    
    return self;
}


- (void)create
{
    self.imageView = [[UIImageView alloc] init];
    
    [self addSubview:self.imageView];
    [_imageView release];
    
    
    self.nameLabel = [[UILabel alloc] init];
    [self addSubview:self.nameLabel];
    [_nameLabel release];
    
    
    self.countLabel = [[UILabel alloc] init];
    [self addSubview:self.countLabel];
    [_countLabel release];
 
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
//    self.imageView.frame = CGRectInset(layoutAttributes.frame, layoutAttributes.frame.size.width / 2 - 30, layoutAttributes.frame.size.height / 2 - 20);
    self.imageView.frame = CGRectMake(layoutAttributes.frame.size.width / 2 - 40, layoutAttributes.frame.size.height / 2 - 30, 80, 40);
    self.imageView.image = [UIImage imageWithContentsOfFile:GETBUNDLE_PATH(@"lloo", @"png")];
   // self.imageView.backgroundColor = [UIColor redColor];
    self.nameLabel.frame = CGRectMake(20, self.imageView.frame.size.height + self.imageView.frame.origin.y + 5, layoutAttributes.frame.size.width - 40, 20);
    [self.nameLabel setTextAlignment:(NSTextAlignmentCenter)];
    self.nameLabel.textColor = [UIColor whiteColor];
    self.countLabel.frame = CGRectMake(20, self.nameLabel.frame.size.height + self.nameLabel.frame.origin.y + 5, layoutAttributes.frame.size.width - 40, 20);
    [self.countLabel setTextAlignment:(NSTextAlignmentCenter)];
    self.countLabel.textColor = [UIColor whiteColor];
}






@end
